<script setup>
import {menuListAPI} from "@/apis/main/menu/menu";
import {ref} from "vue";
import {onMounted} from "vue";

import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'

const menuList = ref([])
onMounted(() => {
  // menuListAPI().then(res => {
  //   if (res.data.code === 200) {
  //     menuList.value = res.data.data
  //   }
  // }).catch(err => {
  //   console.log(err)
  // })

})

</script>

<template>
  <div class="box">
    <el-menu
        router
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="el-menu-vertical-demo"
        default-active="2"
        text-color="#fff"
    >

<!--      一级菜单-->
      <el-sub-menu index="1">
        <template #title>
          <el-icon>
            <Share />
          </el-icon>
          <span>系统管理</span>
        </template>
<!--        二级菜单-->
            <el-menu-item index="/userList">
              <template #title>
                <el-icon>
                  <Share />
                </el-icon>
                <span>用户管理</span>
              </template>
            </el-menu-item>

        <el-menu-item index="/roleList">
          <template #title>
            <el-icon>
              <Share />
            </el-icon>
            <span>角色管理</span>
          </template>
        </el-menu-item>

        <el-menu-item index="/menuList">
          <template #title>
            <el-icon>
              <Share />
            </el-icon>
            <span>权限管理</span>
          </template>
        </el-menu-item>

        <el-menu-item index="/deptList">
          <template #title>
            <el-icon>
              <Share />
            </el-icon>
            <span>部门管理</span>
          </template>
        </el-menu-item>
      </el-sub-menu>


      <el-sub-menu index="2">
        <template #title>
          <el-icon>
            <Share />
          </el-icon>
          <span>资料管理</span>
        </template>
        <!--        二级菜单-->
        <el-menu-item index="/userList">
          <template #title>
            <el-icon>
              <Share />
            </el-icon>
            <span>资料列表</span>
          </template>
        </el-menu-item>

      </el-sub-menu>


      <!--      <el-sub-menu :index="item.name" v-for="(item,index) in menuList" :key="index">-->
<!--        <template #title>-->
<!--          <el-icon>-->
<!--            <component :is="item.meta.icon"/>-->
<!--          </el-icon>-->
<!--          <span>{{ item.meta.title }}</span>-->
<!--        </template>-->
<!--        <el-menu-item :index="child.path" v-for="(child,index) in item.children">-->
<!--          <template #title>-->
<!--            <el-icon>-->
<!--              <component :is="child.meta.icon"/>-->
<!--            </el-icon>-->
<!--            <span>{{ child.meta.title }}</span>-->
<!--          </template>-->
<!--        </el-menu-item>-->
<!--      </el-sub-menu>-->
    </el-menu>
  </div>
</template>

<style lang="scss">
.box {
  height: 100%;
  /* background-color: rgba(0, 0, 0, 0.1);*/
  .el-menu {
    height: 100%;
  }
}

</style>
